<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>人员新增</title>
    <script src="../../../../../res/js/jquery-3.4.1.min.js"></script>
    <script charset="utf-8" src="../../../../../res/layui/layui.js"></script>
    <script src="../../../../../res/js/Tools.js"></script>
    <link href="../../../../../res/layui/css/layui.css" media="all" rel="stylesheet">
    <link href="../../../../../res/echarts/eleTree.css" rel="stylesheet"/>
    <script src="../../../../../res/echarts/eleTree.js"></script>
    <link rel="shortcut icon" type="image/x-icon" href="../../../../../res/images/favicon.ico">
    <script charset="utf-8" src="../../../../../res/js/login_common.js"></script>
    <style type="text/css">
        body {
            padding: 10px;
        }
    </style>
</head>
<body>
<form action="" class="layui-form layui-form-pane">
    <input type="hidden" id="pkCompanyId" name="pkCompanyId">
    <div class="layui-form-item">
        <label class="layui-form-label">公司名</label>
        <div class="layui-input-block">
            <input autocomplete="off" class="layui-input" readonly
                   name="companyName" id="companyName" placeholder="请输入" type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">公司地址</label>
        <div class="layui-input-block">
            <input autocomplete="off" class="layui-input" readonly
                   name="companyArea" id="companyArea" type="text">

            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上级公司</label>
        <div class="layui-input-block">
            <input autocomplete="off" class="layui-input" readonly id="companySuperior" type="text">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">公司负责人</label>
            <div class="layui-input-inline">
                <input autocomplete="off" class="layui-input" readonly id="leaderSuperior" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" style="display: inline-block;">上级领导</label>
            <div class="layui-input-inline">
                <input autocomplete="off" class="layui-input" readonly id="companyLeader" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-inline">
                <input autocomplete="off" class="layui-input" readonly name="companyEmil" id="companyEmil"
                       type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">邮编</label>
            <div class="layui-input-inline">
                <input autocomplete="off" class="layui-input"  name="companyPostcode"
                       id="companyPostcode" readonly type="text">
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea type="textarea" id="remark" name="remark" class="layui-textarea">
            </textarea>
        </div>
    </div>
</form>
<script>
    var form=null;
    layui.use(['form', 'layedit', 'laydate', 'layer'], function () {
        form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

        //表单取值
        layui.$('#LAY-component-form-getval').on('click', function () {
            var data = form.val('example');
            alert(JSON.stringify(data));
        });

        //修改操作
        var ide = getQueryString("pkCompanyId");
        if (ide) {
            findById(ide);//修改页面的赋值
        }

        //重新渲染表单函数
        function renderForm() {
            layui.use('form', function () {
                var form = layui.form(); //高版本建议把括号去掉，有的低版本，需要加()
                form.render();
            });
        }

        form.render();
    });

    function findById(ide) {
        let url = getRootPath() + "/OaCompanyAction/select/" + ide;
        let data = getAjaxById(url);
        $("#pkCompanyId").val(data.data.pkCompanyId);
        $("#companyName").val(data.data.companyName);
        $("#companyArea").val(data.data.companyArea);
        $("#companyEmil").val(data.data.companyEmil);
        $("#companyPostcode").val(data.data.companyPostcode);
        $("#remark").val(data.data.remark);
        $("#companyLeader").val(data.data.superPersonnelName?(data.data.superPersonnelName):"null");
        $("#leaderSuperior").val(data.data.leaderName);
        $("#companySuperior").val(data.data.superCompanyName?(data.data.superCompanyName):"null");
        form.render("select");
    }

</script>
</body>
</html>
</html>